package top.tangyh.lamp.care.controller;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import top.tangyh.basic.annotation.log.WebLog;
import top.tangyh.basic.base.R;
import top.tangyh.basic.interfaces.echo.EchoService;
import top.tangyh.basic.base.controller.SuperController;
import top.tangyh.lamp.care.service.BHl7MoveDetailService;
import top.tangyh.lamp.care.entity.BHl7MoveDetail;
import top.tangyh.lamp.care.vo.result.MoveInfoOutVO;
import top.tangyh.lamp.care.vo.result.OperaInfoOutVO;
import top.tangyh.lamp.care.vo.save.BHl7MoveDetailSaveVO;
import top.tangyh.lamp.care.vo.save.MoveInfoInVO;
import top.tangyh.lamp.care.vo.update.BHl7MoveDetailUpdateVO;
import top.tangyh.lamp.care.vo.result.BHl7MoveDetailResultVO;
import top.tangyh.lamp.care.vo.query.BHl7MoveDetailPageQuery;

import java.util.List;

import static top.tangyh.basic.base.R.success;
import static top.tangyh.lamp.common.constant.SwaggerConstants.DATA_TYPE_LONG;
import static top.tangyh.lamp.common.constant.SwaggerConstants.DATA_TYPE_STRING;

/**
 * <p>
 * 前端控制器
 * 归转记录表
 * </p>
 *
 * @author zqb
 * @date 2024-07-15 13:49:07
 * @create [2024-07-15 13:49:07] [zqb] [代码生成器生成]
 */
@Slf4j
@RequiredArgsConstructor
@Validated
@RestController
@RequestMapping("/move")
@Tag(name = "HL7:归转记录")
public class BHl7MoveDetailController  {

//    extends SuperController<BHl7MoveDetailService, Long, BHl7MoveDetail
//            , BHl7MoveDetailSaveVO, BHl7MoveDetailUpdateVO, BHl7MoveDetailPageQuery, BHl7MoveDetailResultVO>
//    private final EchoService echoService;
//    @Override
//    public EchoService getEchoService() {
//        return echoService;
//    }

    private  final BHl7MoveDetailService bHl7MoveDetailService;

    @Parameters({
            @Parameter(name = "hospitalNumber", description = "住院号", schema = @Schema(type = DATA_TYPE_STRING), in = ParameterIn.QUERY),
    })
    @Operation(summary = "查询患者的归档记录列表")
    @GetMapping("/list")
    @WebLog(value = "查询患者的归档记录列表")
    public R<List<MoveInfoOutVO>> listOperaInfo(@RequestParam String hospitalNumber) {
        return success(bHl7MoveDetailService.listMoveInfoInVO(hospitalNumber));
    }


    @Operation(summary ="添加归转")
    @PostMapping
    public R add(@RequestBody MoveInfoInVO infoInVO) {
        bHl7MoveDetailService.addMoveInfo(infoInVO);
        return R.success();
    }

    @Operation(summary ="修改归转")
    @PutMapping
    public R update(@RequestBody MoveInfoInVO moveInfoInVO) {
        bHl7MoveDetailService.updateMoveInfo(moveInfoInVO);
        return R.success();
    }

    @Operation(summary ="删除归转")
    @DeleteMapping
    public R delete(Long id) {
        bHl7MoveDetailService.deleteMoveInfo(id);
        return R.success();
    }

}


